var SysTplPconfigAddObj = function () {
    var validateFormData = function () {
        var icon = "<i class='fa fa-times-circle'></i> ";
        $("#sysTplPconfigSignupForm").validate({
            rules: {
                confkey:{ required: true,maxlength: 255,},
                confvalue:{maxlength: 255,},
                description:{maxlength: 255,},
            },
            messages: {
                confkey:{ required: "配置key是必须项",maxlength:icon + "用户名必须255个字符以下",},
                confvalue:{maxlength:icon + "用户名必须255个字符以下",},
                description:{maxlength:icon + "用户名必须255个字符以下",},
            },
            success: function (label) {
                //console.log("111")
            },

            errorPlacement: function (error, element) {
                element.parent('div').append(error);
            },

            submitHandler: function (form) {
                saveDo();
            }
        });
    };
    var saveDo = function () {
        var data = utils.getFormData('sysTplPconfigSignupForm');
        $("#submitOk").attr({"disabled":"disabled"});
        utils.submitForm('sysTplPconfigSignupForm', '/sysTplPconfig/save.do', data, function (result) {
            if (result.success) {
                swal({
                    title: "新增成功！",
                    text: "您的这条信息已录入系统。",
                    type: "success"
                },function(){
                    window.location.href ='/sysTplPconfig/sysTplPconfigList.show';
                });
            } else {
                swal("新增失败！", "新增这条信息失败。", "error");
                $("#submitOk").removeAttr("disabled");
            }


        });
    };
    return {
        init: validateFormData,
        saveDo: saveDo
    }
}();

var laydate_ = function () {
    laydate({istime: true, format: 'YYYY-MM-DD  hh:mm:ss'})
};